<script>
export default {
  name: 'amount component',
  props: {
    id: {
      type: Number,
      required: true
    },
    count: {
        type: Number,
        required: true
    }
  },
  data() {
    return {
      value: this.count
    }
  },
  methods: {
    amountChange(current, old){
      let payload = { id: this.id, amount: current };
      this.$bus.emit('数量改变', payload );
    }
  }
}
</script>

<template>
  <el-input-number v-model="value"
                   :min="1"
                   @change="amountChange"></el-input-number>
</template>

<style>

</style>